package com.lcb.spring.condition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class LcbCondition implements Condition {

    /**
     * @param context
     * @param metadata
     * @return
     */
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        //判断容器中是否有lCBAspect的组件
        if (context.getBeanFactory().containsBean("lCBAspect")) {
            return true;
        }
        return false;
    }
}
